var next = new Vue({
    el: "#vm",
    data: {
        msg: "temp",
        error: false,
        isActive: true
    },
    computed: {
        classObj: function () {
            return {
                active: this.isActive && !this.error,
                'text-danger': this.error && this.error.type === 'fatal'
            }
        }
    },
    filters: {
        capitalize: function (value) {
            if (!value) return '';
            value = value.toString();
            return value.charAt(0).toUpperCase() + value.slice(1);
        }
    }
});
var vm = new Vue({
    el: '#app',
    data: {
        km: 0,
        m: 0,
        person: {
            age: 0,
            mature: ''
        }
    },
    methods: {
        checkAge: function () {
            this.person.mature = (this.person.age >= 18) ? '成年' : '未成年';
        }
    },
    computed: {
    },
    watch: {
        km: function (val) { // 不同数据的listener
            this.m = val * 1000;
        },
        m: function (val, oldVal) { // arguments [0] -- new val [1] -- old val [2] -- callee
            this.km = val / 1000;
        },
        person: {
            handler: 'checkAge',
            deep: true
        }
    }
})